package com.tongfusoft.document.doc.service;

import java.util.List;

import org.springframework.web.multipart.MultipartFile;

import com.tongfusoft.da.pagehelper.PageInfo;
import com.tongfusoft.document.entity.BigFiles;
import com.tongfusoft.document.entity.FileFragments;
import com.tongfusoft.document.entity.UploadInfo;
import com.tongfusoft.document.entity.Users;

public interface IPluploadService {

	/**
	 * 保存文件碎片到硬盘
	 * 
	 * @param file
	 * @param user
	 * @param uploadInfo
	 * @return
	 */
	public boolean saveFile(MultipartFile file, Users user, UploadInfo uploadInfo);

	/**
	 * 保存文件碎片信息
	 * 
	 * @param uploadInfo
	 * @param user
	 */
	public void Uploaded(UploadInfo uploadInfo, Users user);

	/**
	 * 查询文件是否已经存在
	 * 
	 * @param fileMd5
	 * @return
	 */
	public boolean isMd5Exist(String fileMd5,Users user);

	/**
	 * 打文件列表
	 * @param pageSize
	 * @param pageIndex
	 * @param bigFile
	 * @return
	 */
	public PageInfo bigFilesList(int pageSize, int pageIndex, BigFiles bigFile);
	
	/**
	 * 碎片是否存在
	 * @param md5
	 * @param chunk
	 * @return
	 */
	public boolean isFragmentsExist(String md5,String chunk);

	/**
	 * 删除大文件
	 * @param id
	 */
	public void deleteBigFile(String id,Users user);
	
	/**
	 * 获取当前文件的碎片
	 * @param md5
	 * @return
	 */
	public List<FileFragments> fragmentListByMd5(String md5,Users user);
}
